﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace PS.Practices.Provisioner.Sandbox.Test.Core
{
    public abstract class WebOperation
    {
        public abstract void Execute();
    }

    public abstract class ListOperation
    {
        public abstract void Execute();
    }

    public abstract class ListCTypeOperation : ListOperation
    {
        private List<ContentTypeRef> contentTypes = new List<ContentTypeRef>();

        [XmlElement("ContentTypeRef")]
        public List<ContentTypeRef> ContentTypes
        {
            get { return contentTypes; }
            set { contentTypes = value; }
        }
    }

    public abstract class WebACLAction
    {
        public abstract void Process();
    }

    public abstract class WebpartOperation
    {
        public abstract void Process();
    }

    [XmlRoot("Provisioner")]
    public class ProvisionerRoot
    {
        public class MasterPageActions
        {
            public static string NoneAction = "{{None}}";
            public static string SetToParent = "{{Parent}}";
            public static string SetToRoot = "{{Root}}";
        }

        private string showErrors;
        private string applyWebTemplate;
        private List<WebOperation> webOperations;

        [XmlAttribute]
        public string ShowErrors
        {
            get { return showErrors; }
            set { showErrors = value; }
        }

        [XmlElement(typeof(FixupLists))]
        [XmlElement(typeof(RestrictSiteTemplates))]
        [XmlElement(typeof(RestoreWebProperties))]
        [XmlElement(typeof(CustomizedCssFiles))]
        [XmlElement(typeof(SetStyling))]
        [XmlElement(typeof(ProvisionWebs))]
        [XmlElement(typeof(FixupWebACL))]
        //[XmlElement(typeof(FixupFiles))]
        public List<WebOperation> Operations
        {
            get { return webOperations; }
            set { webOperations = value; }
        }

        [XmlAttribute]
        public string ApplyWebTemplate
        {
            get { return applyWebTemplate; }
            set { applyWebTemplate = value; }
        }

        private string setMasterPage = MasterPageActions.NoneAction;

        [XmlAttribute]
        public string MasterUrl
        {
            get { return setMasterPage; }
            set { setMasterPage = value; }
        }

        private string setCustomMasterPage = MasterPageActions.NoneAction;

        [XmlAttribute]
        public string CustomMasterUrl
        {
            get { return setCustomMasterPage; }
            set { setCustomMasterPage = value; }
        }
    }

    public class FixupLists : WebOperation
    {
        private bool syncCTypeLocalFieldSettings;
        private List<List> lists = new List<List>();


        public bool SyncCTypeLocalFieldSettings
        {
            get { return syncCTypeLocalFieldSettings; }
            set { syncCTypeLocalFieldSettings = value; }
        }

        [XmlAttribute("SyncCTypeLocalFieldSettings")]
        public string SyncCTypeLocalFieldSettingsStr
        {
            get { return syncCTypeLocalFieldSettings.ToString(); }
            set { syncCTypeLocalFieldSettings = bool.Parse(value); }
        }

        [XmlElement("List")]
        public List<List> Lists
        {
            get { return lists; }
            set { lists = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class RestrictSiteTemplates : WebOperation
    {
        private List<Template> templates = new List<Template>();

        [XmlElement("Template")]
        public List<Template> Templates
        {
            get { return templates; }
            set { templates = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class Template
    {
        private string lcid;
        private string value;

        [XmlAttribute]
        public string LCID
        {
            get { return lcid; }
            set { lcid = value; }
        }

        [XmlText]
        public string Value
        {
            get { return value; }
            set { this.value = value; }
        }
    }

    public class Layout
    {

        private string value;

        [XmlText]
        public string Value
        {
            get { return value; }
            set { this.value = value; }
        }
    }

    public class RestoreWebProperties : WebOperation
    {
        private WebProperies webProperties;

        [XmlElement]
        public WebProperies WebProperties
        {
            get { return webProperties; }
            set { webProperties = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class WebProperies
    {
        private List<WebProperty> properties = new List<WebProperty>();

        [XmlElement("WebProperty")]
        public List<WebProperty> Properties
        {
            get { return properties; }
            set { properties = value; }
        }
    }

    public class WebProperty
    {
        private string key;
        private string value;

        [XmlAttribute]
        public string Key
        {
            get { return key; }
            set { key = value; }
        }

        [XmlAttribute]
        public string Value
        {
            get { return value; }
            set { this.value = value; }
        }
    }

    public class CustomizedCssFiles : WebOperation
    {
        private List<CustomizedCssFile> files = new List<CustomizedCssFile>();

        [XmlElement("CustomizedCssFile")]
        public List<CustomizedCssFile> Files
        {
            get { return files; }
            set { files = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class SetStyling : WebOperation
    {
        [XmlAttribute]
        public string ApplyTheme
        {
            get;
            set;
        }

        [XmlAttribute]
        public string AlternateCss
        {
            get;
            set;
        }

        [XmlAttribute]
        public string SiteLogoUrl
        {
            get;
            set;
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class CustomizedCssFile
    {
        private string name;

        [XmlAttribute]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }

    public class Web
    {
        public class ActionContainer
        {
            public ActionContainer()
            {
                Operations = new List<WebOperation>();
                Enabled = true;
            }

            [XmlElement(typeof(FixupLists))]
            [XmlElement(typeof(RestrictSiteTemplates))]
            [XmlElement(typeof(RestoreWebProperties))]
            [XmlElement(typeof(CustomizedCssFiles))]
            [XmlElement(typeof(SetStyling))]
            [XmlElement(typeof(ProvisionWebs))]
            [XmlElement(typeof(FixupWebACL))]
            //[XmlElement(typeof(FixupFiles))]
            public List<WebOperation> Operations { get; set; }
            
            [XmlAttribute]
            public bool Enabled { get; set; }
        }

        public Web()
        {
            Webs = new List<Web>();
            Actions = new ActionContainer();
        }

        [XmlElement("Actions")]
        public ActionContainer Actions { get; set; }

        [XmlElement("Web")]
        public List<Web> Webs { get; set; }

        [XmlAttribute]
        public string Title { get; set; }

        [XmlAttribute]
        public string Description { get; set; }

        [XmlAttribute]
        public string Template { get; set; }

        [XmlAttribute]
        public string Url { get; set; }

        [XmlAttribute]
        public string LCID { get; set; }

        private bool? uniquePermissions;

        [XmlIgnore]
        public bool? UniquePermissions
        {
            get { return uniquePermissions; }
            set { uniquePermissions = value; }
        }

        private bool? inheritTopNav;

        [XmlIgnore]
        public bool? InheritTopNav
        {
            get { return inheritTopNav; }
            set { inheritTopNav = value; }
        }


        [XmlAttribute("UniquePermissions")]
        public string StrUniquePermissions
        {
            get { return GetValue(uniquePermissions); }
            set { SetBool(ref uniquePermissions, value); }
        }

        [XmlAttribute("InheritTopNav")]
        public string StrInheritTopNav
        {
            get { return GetValue(inheritTopNav); }
            set { SetBool(ref inheritTopNav, value); }
        }

        private static string GetValue(bool? value)
        {
            return value.HasValue ? value.Value.ToString() : null;
        }
        private static void SetBool(ref bool? prop, string value)
        {
            if (!string.IsNullOrEmpty(value))
            {
                prop = bool.Parse(value);
            }
            else
                prop = null;
        }
    }

    public class ProvisionWebs : WebOperation
    {
        private List<Web> webs = new List<Web>();

        [XmlElement("Web")]
        public List<Web> Webs
        {
            get { return webs; }
            set { webs = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class Extension
    {
        private string assembly;
        private string tagPrefix;

        [XmlAttribute()]
        public string Assembly
        {
            get { return assembly; }
            set { assembly = value; }
        }

        [XmlAttribute()]
        public string TagPrefix
        {
            get { return tagPrefix; }
            set { tagPrefix = value; }
        }


        public Extension(string assembly, string tagPrefix)
        {
            Assembly = assembly;
            TagPrefix = tagPrefix;
        }
    }

    public class List
    {
        private string title;
        private bool delete;
        private bool enableContentTypes;
        private string emailEnable;
        private List<ListOperation> operations = new List<ListOperation>();

        [XmlAttribute()]
        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        [XmlAttribute()]
        public bool Delete
        {
            get { return delete; }
            set { delete = value; }
        }

        [XmlAttribute()]
        public bool EnableContentTypes
        {
            get { return enableContentTypes; }
            set { enableContentTypes = value; }
        }

        [XmlElement(typeof(SetSendToLocation))]
        [XmlElement(typeof(UpdateTitle))]
        [XmlElement(typeof(ReorderCTypes))]
        [XmlElement(typeof(FixupACL))]
        [XmlElement(typeof(FixupView))]
        [XmlElement(typeof(UpdateFields))]
        [XmlElement(typeof(AddFields))]
        [XmlElement(typeof(ListItem))]
        [XmlElement(typeof(AddCTypes))]
        [XmlElement(typeof(RemoveCTypes))]
        public List<ListOperation> Operations
        {
            get { return operations; }
            set { operations = value; }
        }

        [XmlAttribute("EMailEnable")]
        public string EmailEnable
        {
            get { return emailEnable; }
            set { emailEnable = value; }
        }

        [XmlAttribute("MajorVersionLimit")]
        public int MajorVersionLimit
        {
            get;
            set;
        }
        [XmlAttribute("MinorVersionLimit")]
        public int MinorVersionLimit
        {
            get;
            set;
        }
        [XmlAttribute("DraftSecurity")]
        public string DraftSecurity
        {
            get;
            set;
        }
    }

    public class SetSendToLocation : ListOperation
    {
        private string name;
        private string url;

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [XmlAttribute()]
        public string Url
        {
            get { return url; }
            set { url = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class Replace
    {
        private string match;
        private string value;

        [XmlAttribute()]
        public string Match
        {
            get { return match; }
            set { match = value; }
        }

        [XmlText()]
        public string Value
        {
            get { return value; }
            set { this.value = value; }
        }
    }

    public class ContentTypeRef
    {
        private string id;
        private string name;

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [XmlAttribute()]
        public string ID
        {
            get { return id; }
            set { id = value; }
        }
    }

    public class UpdateTitle : ListOperation
    {
        private string set;
        private List<Replace> replaceInfo = new List<Replace>();

        //TODO: Possibly Set is excess
        [XmlAttribute()]
        public string Set
        {
            get { return set; }
            set { set = value; }
        }

        [XmlElement("Replace")]
        public List<Replace> ReplaceInfo
        {
            get { return replaceInfo; }
            set { replaceInfo = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class AddCTypes : ListCTypeOperation
    {
        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class RemoveCTypes : ListCTypeOperation
    {
        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class ReorderCTypes : ListOperation
    {
        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class PrincipalListRole
    {
        private string role;
        private string name;
        private string action;
        private string type;

        [XmlAttribute()]
        public string Role
        {
            get { return role; }
            set { role = value; }
        }

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [XmlAttribute()]
        public string Action
        {
            get { return action; }
            set { action = value; }
        }

        [XmlAttribute()]
        public string Type
        {
            get { return type; }
            set { type = value; }
        }
    }

    public class FixupACL : ListOperation
    {
        private string roleAssignments;
        private List<PrincipalListRole> roles = new List<PrincipalListRole>();

        [XmlAttribute()]
        public string RoleAssignments
        {
            get { return roleAssignments; }
            set { roleAssignments = value; }
        }

        [XmlElement("PrincipalRole")]
        public List<PrincipalListRole> Roles
        {
            get { return roles; }
            set { roles = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class LessField
    {
        private string name;

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }

    public class InjectCTypeFields
    {
        private int position;
        private List<LessField> fields = new List<LessField>();

        [XmlAttribute()]
        public int Position
        {
            get { return position; }
            set { position = value; }
        }

        [XmlElement("LessField")]
        public List<LessField> Fields
        {
            get { return fields; }
            set { fields = value; }
        }
    }

    public class ViewField
    {
        private string name;

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }

    public class InjectViewFields
    {
        private List<ViewField> viewFields = new List<ViewField>();

        [XmlElement("ViewField")]
        public List<ViewField> ViewFields
        {
            get { return viewFields; }
            set { viewFields = value; }
        }
    }

    public class FixupView : ListOperation
    {
        private string name;
        private List<InjectCTypeFields> injectTypes = new List<InjectCTypeFields>();
        private List<InjectViewFields> injectViewFields = new List<InjectViewFields>();

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [XmlElement("InjectCTypeFields")]
        public List<InjectCTypeFields> InjectTypes
        {
            get { return injectTypes; }
            set { injectTypes = value; }
        }

        [XmlElement("InjectViewFields")]
        public List<InjectViewFields> InjectFields
        {
            get { return injectViewFields; }
            set { injectViewFields = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class FieldChoices
    {
        private bool flush;
        private List<string> choices = new List<string>();

        [XmlAttribute()]
        public bool Flush
        {
            get { return flush; }
            set { flush = value; }
        }

        // TODO: check deserialization
        [XmlElement("Choice")]
        public List<string> Choices
        {
            get { return choices; }
            set { choices = value; }
        }
    }

    public class UpdateField
    {
        private string displayName;
        private string staticName;
        private string description;
        private bool dumpFields;
        private bool linkToLocalCTypes;
        private string defaultValue;
        private FieldChoices choices;

        [XmlAttribute()]
        public string DisplayName
        {
            get { return displayName; }
            set { displayName = value; }
        }

        [XmlAttribute()]
        public string StaticName
        {
            get { return staticName; }
            set { staticName = value; }
        }

        public string Description
        {
            get { return description; }
            set { description = value; }
        }

        public bool DumpFields
        {
            get { return dumpFields; }
            set { dumpFields = value; }
        }

        [XmlAttribute()]
        public bool LinkToLocalCTypes
        {
            get { return linkToLocalCTypes; }
            set { linkToLocalCTypes = value; }
        }

        public FieldChoices Choices
        {
            get { return choices; }
            set { choices = value; }
        }

        // TODO : check deserialization
        public string Default
        {
            get { return defaultValue; }
            set { defaultValue = value; }
        }
    }

    public class UpdateFields : ListOperation
    {
        private List<UpdateField> fields = new List<UpdateField>();

        [XmlElement("Field")]
        public List<UpdateField> Fields
        {
            get { return fields; }
            set { fields = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class AddField
    {
        private string field;
        private bool addToDefaultView;

        [XmlText()]
        public string Field
        {
            get { return field; }
            set { field = value; }
        }

        [XmlAttribute()]
        public bool AddToDefaultView
        {
            get { return addToDefaultView; }
            set { addToDefaultView = value; }
        }
    }

    public class AddFields : ListOperation
    {
        private List<AddField> fields = new List<AddField>();

        [XmlElement("Field")]
        public List<AddField> Fields
        {
            get { return fields; }
            set { fields = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class ListItem : ListOperation
    {
        private string type;
        private string name;
        private int id = -1;
        private FixupItemACL fixupItemACL;
        private FileStatus fileStatus;

        [XmlElement]
        public FileStatus FileStatus
        {
            get { return fileStatus; }
            set { fileStatus = value; }
        }

        [XmlAttribute()]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [XmlElement("FixupACL")]
        public FixupItemACL FixupItemACL
        {
            get { return fixupItemACL; }
            set { fixupItemACL = value; }
        }

        [XmlAttribute()]
        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        [XmlAttribute()]
        public string Type
        {
            get { return type; }
            set { type = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class FileStatus
    {

        public enum Status
        {
            CheckIn, CheckOut, Publish
        }

        private Status status;

        [XmlAttribute]
        public Status SetStatus
        {
            get { return status; }
            set { status = value; }
        }
    }

    public class FixupItemACL
    {
        private string roleAssignments;
        private List<PrincipalItemRole> principalItemRoles;

        [XmlAttribute()]
        public string RoleAssignments
        {
            get { return roleAssignments; }
            set { roleAssignments = value; }
        }

        [XmlElement("PrincipalRole")]
        public List<PrincipalItemRole> PrincipalItemRoles
        {
            get { return principalItemRoles; }
            set { principalItemRoles = value; }
        }
    }

    public class PrincipalItemRole : PrincipalListRole
    {
    }

    public class FixupWebACL : WebOperation
    {
        private bool inheritTopNav;
        private bool respectInheritanceSetting;
        private string roleAssignments;
        private string syncGroupQuickLaunch;
        private List<WebACLAction> webACLActions = new List<WebACLAction>();

        [XmlAttribute]
        public bool InheritTopNav
        {
            [DebuggerStepThrough]
            get { return inheritTopNav; }

            [DebuggerStepThrough]
            set { inheritTopNav = value; }
        }

        [XmlAttribute]
        public bool RespectInheritanceSetting
        {
            [DebuggerStepThrough]
            get { return respectInheritanceSetting; }

            [DebuggerStepThrough]
            set { respectInheritanceSetting = value; }
        }

        [XmlAttribute]
        public string RoleAssignments
        {
            [DebuggerStepThrough]
            get { return roleAssignments; }

            [DebuggerStepThrough]
            set { roleAssignments = value; }
        }

        [XmlElement(typeof(AssociateSiteGroup))]
        [XmlElement(typeof(SiteGroup))]
        public List<WebACLAction> Operations
        {
            get { return webACLActions; }
            set { webACLActions = value; }
        }

        [XmlAttribute]
        public string SyncGroupQuickLaunch
        {
            [DebuggerStepThrough]
            get { return syncGroupQuickLaunch; }

            [DebuggerStepThrough]
            set { syncGroupQuickLaunch = value; }
        }

        public override void Execute()
        {
            throw new NotImplementedException();
        }
    }

    public class AssociateSiteGroup : WebACLAction
    {
        private string role;
        private string name;
        private string addToQuickLaunch;

        [XmlAttribute]
        public string Role
        {
            [DebuggerStepThrough]
            get { return role; }

            [DebuggerStepThrough]
            set { role = value; }
        }

        [XmlAttribute]
        public string Name
        {
            [DebuggerStepThrough]
            get { return name; }

            [DebuggerStepThrough]
            set { name = value; }
        }

        [XmlAttribute]
        public string AddToQuickLaunch
        {
            [DebuggerStepThrough]
            get { return addToQuickLaunch; }

            [DebuggerStepThrough]
            set { addToQuickLaunch = value; }
        }


        public override void Process()
        {
            throw new NotImplementedException();
        }
    }

    public class SiteGroup : WebACLAction
    {
        private string action;
        private string name;
        private string description;
        private bool allowMembersEditMembership;
        private bool allowRequestToJoinLeave;
        private bool autoAcceptRequestToJoinLeave;
        private bool onlyAllowMembersViewMembership;
        private string requestToJoinLeaveEmailSetting;
        private string owner;

        [XmlAttribute]
        public string Action
        {
            [DebuggerStepThrough]
            get { return action; }

            [DebuggerStepThrough]
            set { action = value; }
        }

        [XmlAttribute]
        public string Name
        {
            [DebuggerStepThrough]
            get { return name; }

            [DebuggerStepThrough]
            set { name = value; }
        }

        [XmlAttribute]
        public string Description
        {
            [DebuggerStepThrough]
            get { return description; }

            [DebuggerStepThrough]
            set { description = value; }
        }

        [XmlAttribute()]
        public bool AllowMembersEditMembership
        {
            [DebuggerStepThrough]
            get { return allowMembersEditMembership; }

            [DebuggerStepThrough]
            set { allowMembersEditMembership = value; }
        }

        [XmlAttribute()]
        public bool AllowRequestToJoinLeave
        {
            [DebuggerStepThrough]
            get { return allowRequestToJoinLeave; }

            [DebuggerStepThrough]
            set { allowRequestToJoinLeave = value; }
        }

        [XmlAttribute()]
        public bool AutoAcceptRequestToJoinLeave
        {
            [DebuggerStepThrough]
            get { return autoAcceptRequestToJoinLeave; }

            [DebuggerStepThrough]
            set { autoAcceptRequestToJoinLeave = value; }
        }

        [XmlAttribute()]
        public bool OnlyAllowMembersViewMembership
        {
            [DebuggerStepThrough]
            get { return onlyAllowMembersViewMembership; }

            [DebuggerStepThrough]
            set { onlyAllowMembersViewMembership = value; }
        }

        [XmlAttribute()]
        public string RequestToJoinLeaveEmailSetting
        {
            [DebuggerStepThrough]
            get { return requestToJoinLeaveEmailSetting; }

            [DebuggerStepThrough]
            set { requestToJoinLeaveEmailSetting = value; }
        }

        [XmlAttribute()]
        public string Owner
        {
            [DebuggerStepThrough]
            get { return owner; }

            [DebuggerStepThrough]
            set { owner = value; }
        }

        public override void Process()
        {
            throw new NotImplementedException();
        }
    }

    public class PrincipalRole : WebACLAction
    {
        private string role;
        private string name;
        private string type;
        private string action;

        [XmlAttribute]
        public string Role
        {
            [DebuggerStepThrough]
            get { return role; }

            [DebuggerStepThrough]
            set { role = value; }
        }

        [XmlAttribute]
        public string Name
        {
            [DebuggerStepThrough]
            get { return name; }

            [DebuggerStepThrough]
            set { name = value; }
        }

        [XmlAttribute]
        public string Type
        {
            [DebuggerStepThrough]
            get { return type; }

            [DebuggerStepThrough]
            set { type = value; }
        }

        [XmlAttribute]
        public string Action
        {
            [DebuggerStepThrough]
            get { return action; }

            [DebuggerStepThrough]
            set { action = value; }
        }

        public override void Process()
        {
            throw new NotImplementedException();
        }
    }

    public class User : WebACLAction
    {
        private string action;
        private string loginName;
        private string displayName;
        private string email;
        private string description;

        [XmlAttribute]
        public string Action
        {
            [DebuggerStepThrough]
            get { return action; }

            [DebuggerStepThrough]
            set { action = value; }
        }

        [XmlAttribute]
        public string LoginName
        {
            [DebuggerStepThrough]
            get { return loginName; }

            [DebuggerStepThrough]
            set { loginName = value; }
        }

        [XmlAttribute]
        public string DisplayName
        {
            [DebuggerStepThrough]
            get { return displayName; }

            [DebuggerStepThrough]
            set { displayName = value; }
        }

        [XmlAttribute]
        public string Email
        {
            [DebuggerStepThrough]
            get { return email; }

            [DebuggerStepThrough]
            set { email = value; }
        }

        [XmlAttribute]
        public string Description
        {
            [DebuggerStepThrough]
            get { return description; }

            [DebuggerStepThrough]
            set { description = value; }
        }

        public override void Process()
        {
            throw new NotImplementedException();
        }
    }

    public class FbaRole : WebACLAction
    {
        private string action;
        private string name;

        [XmlAttribute]
        public string Action
        {
            [DebuggerStepThrough]
            get { return action; }

            [DebuggerStepThrough]
            set { action = value; }
        }

        [XmlAttribute]
        public string Name
        {
            [DebuggerStepThrough]
            get { return name; }

            [DebuggerStepThrough]
            set { name = value; }
        }

        public override void Process()
        {
            throw new NotImplementedException();
        }
    }

    /// <summary>
    ///  Web parts.
    ///  </summary>

    //public class FixupFiles : WebOperation
    //{
    //    private List<File> files = new List<File>();

    //    [XmlElement("File")]
    //    public List<File> Files
    //    {
    //        get { return files; }
    //        set { files = value; }
    //    }

    //    public override void Execute()
    //    {
    //        throw new NotImplementedException();
    //    }
    //}

    //public class File
    //{
    //    private string path;
    //    private List<WebPart> webParts = new List<WebPart>();
    //    private List<DataViewsZone> dataViewsZone = new List<DataViewsZone>();

    //    [XmlAttribute]
    //    public string Path
    //    {
    //        get { return path; }
    //        set { path = value; }
    //    }

    //    [XmlElement("WebPart")]
    //    public List<WebPart> WebParts
    //    {
    //        get { return webParts; }
    //        set { webParts = value; }
    //    }

    //    [XmlElement(typeof(DataViewsInZone))]
    //    [XmlElement(typeof(DataViewsOutZone))]
    //    public List<DataViewsZone> DataViewsZone
    //    {
    //        get { return dataViewsZone; }
    //        set { dataViewsZone = value; }
    //    }
    //}

    //public class WebPart
    //{
    //    private string title;

    //    private List<WebpartOperation> operations;

    //    [XmlAttribute]
    //    public string Title
    //    {
    //        get { return title; }
    //        set { title = value; }
    //    }

    //    [XmlElement(typeof(SetListViewAndToolbar))]
    //    [XmlElement(typeof(UpdateWebPartTitle))]
    //    [XmlElement(typeof(SetProperty))]
    //    public List<WebpartOperation> Operations
    //    {
    //        get { return operations; }
    //        set { operations = value; }
    //    }
    //}

    //public abstract class DataViewsZone
    //{
    //    private ListInstance[] listInstances;

    //    [XmlArray("ListInstances")]
    //    public ListInstance[] ListInstances
    //    {
    //        get { return listInstances; }
    //        set { listInstances = value; }
    //    }

    //    public abstract void Process();
    //}

    //public class DataViewsInZone : DataViewsZone
    //{
    //    public override void Process()
    //    {
    //        throw new NotImplementedException();
    //    }
    //}

    //public class DataViewsOutZone : DataViewsZone
    //{
    //    public override void Process()
    //    {
    //        throw new NotImplementedException();
    //    }
    //}

    //public class ListInstance
    //{
    //    private string id;
    //    private string title;

    //    [XmlAttribute]
    //    public string ID
    //    {
    //        get { return id; }
    //        set { id = value; }
    //    }

    //    [XmlAttribute]
    //    public string Title
    //    {
    //        get { return title; }
    //        set { title = value; }
    //    }
    //}

    //public class SetListViewAndToolbar : WebpartOperation
    //{
    //    private string view;
    //    private string list;
    //    private string toolbar;
    //    private string listUrl;

    //    [XmlAttribute]
    //    public string View
    //    {
    //        get { return view; }
    //        set { view = value; }
    //    }

    //    [XmlAttribute]
    //    public string List
    //    {
    //        get { return list; }
    //        set { list = value; }
    //    }

    //    [XmlAttribute]
    //    public string Toolbar
    //    {
    //        get { return toolbar; }
    //        set { toolbar = value; }
    //    }

    //    [XmlAttribute]
    //    public string ListUrl
    //    {
    //        get { return listUrl; }
    //        set { listUrl = value; }
    //    }

    //    public override void Process()
    //    {
    //        throw new NotImplementedException();
    //    }
    //}

    //public class UpdateWebPartTitle : WebpartOperation
    //{
    //    private string set;

    //    [XmlAttribute]
    //    public string Set
    //    {
    //        get { return set; }
    //        set { set = value; }
    //    }

    //    public override void Process()
    //    {
    //        throw new NotImplementedException();
    //    }
    //}

    //public class SetProperty : WebpartOperation
    //{
    //    private string name;
    //    private string value;

    //    [XmlAttribute]
    //    public string Name
    //    {
    //        get { return name; }
    //        set { name = value; }
    //    }

    //    [XmlAttribute]
    //    public string Value
    //    {
    //        get { return value; }
    //        set { this.value = value; }
    //    }

    //    public override void Process()
    //    {
    //        throw new NotImplementedException();
    //    }
    //}
}
